package flatlandAgent;

import javax.swing.JFrame;

public class FlatlandPanelTest {
	
	public static void main(String[] args) throws InterruptedException {
		FlatlandGame game = new FlatlandGame(new FlatlandMap(0.5, 0.5));
		
		JFrame frame = new JFrame(); 
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
		frame.setContentPane(game.getGamePanel()); 
		frame.setSize(1000, 1000); 
		frame.setVisible(true); 
		
		for (int i = 0; i < 100; i++) {
			doRandomMove(game); 
		}

	}
	
	private static void doRandomMove(FlatlandGame game) throws InterruptedException{
		double move = Math.random(); 
		if (move < 0.5){
			game.move(FlatlandModel.Action.MOVE_FORWARD);
		} else if (move < 0.75){
			game.move(FlatlandModel.Action.MOVE_LEFT);
		} else {
			game.move(FlatlandModel.Action.MOVE_RIGHT);
		}
		Thread.sleep(1000);
	}

}
